home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / Shells / Matrix11.lha / man / Matrix.MAN
Encoding:
Text File  |  1994-01-07  |  12.8 KB  |  382 lines

  1. MATRIX                USER COMMANDS            06-Jan-1993
  2.  
  3.  
  4. NAME
  5.     matrix - menu system for AXsh (version 1.1)
  6.  
  7. SYNOPSIS
  8.     matrix [[menufile] [prompt] | chat | abort | page <text> |
  9.         force <command>]
  10.  
  11. DESCRIPTION
  12.     Matrix is a replacement for the Topic menuing system by Markku
  13.     'Hack' Mellanen.  I used Topic for half a year, but eventually
  14.     became frustrated with its quirks and lack of expandability
  15.     and got tired of hex-editing in my corrections, so I wrote my own.
  16.     Matrix is intended for use with AXsh, but it can be used from
  17.     AmigaDOS or another BBS if you want (consult the OTHER SYSTEMS
  18.     section for this).  Matrix is largely compatible with Topic, but
  19.     it also provides a large number of extensions.  Here's a summary
  20.     of the differences:
  21.  
  22.     - full shell support (local/global variables, piping, etc)
  23.     - all options can be combined
  24.     - better support for submenus
  25.     - all actions by users are logged
  26.     - expert/verbose mode selection
  27.     - instant menu redrawing, pause option
  28.     - support for "timeout" utility, detection of AXsh:etc/nologin
  29.     - commands to run from outside for page, forced chat, and abort
  30.     - user-definable abort/chat/force commands
  31.     - attempts to notice carrier loss and acts accordingly
  32.  
  33.     As of Jan 1994, Timeout (a time limit utility) is not ready for
  34.     release, so ignore references to it here.
  35.  
  36. NEW FEATURES
  37.     Matrix v1.1 is a stopgap release to fix the massive security bug
  38.     I realized had been in it (and Topic) all along.  Namely, if
  39.     the user decided to create his own menu file...perhaps with a menu
  40.     item like "axsh:bin/axsh -con -user root"...  Need I say more?
  41.     Matrix now supports a MATRIX_DIR variable where the sysop can enter
  42.     legal directories for menus.  
  43.  
  44.     The other changes are also primarily security/safety features.
  45.     Being an intermediate release, the code actually has some of
  46.     the nifty client/server multitask code I was working on, but it's
  47.     #ifdef'd out and never invoked.
  48.  
  49.     Features added or significantly changed in Matrix since v1.0:
  50.  
  51.     - Aforementioned security bug fixed with ENV:MATRIX_DIR variable.
  52.     - Users kicked out of Matrix if 5 invalid commands are given.  This
  53.       is an attempt to deal with carrier drops, which often cause the
  54.       modem to spew/repeat junk for a while, making Topic/Matrix 1.0
  55.       loop endlessly.
  56.     - CTRL-C processed instead of just aborting instantly.
  57.     - Users cannot enter MSG_* in menus.
  58.     - All gets() replaced with fgets(stdin), now users cannot crash
  59.       machine simply by entering tons of junk.
  60.     - Superuser rights given to all users with one of these accesslevels:
  61.       assistant, superuser, wizard, system
  62.  
  63.     I attempted to implent an autologout system, bu evidently WaitForChar()
  64.     doesn't like AXsh or serial input, so I had to resort to the current
  65.     approach.  I'll try it with a different approach for v2.0.
  66.  
  67. REQUIREMENTS
  68.     Matrix requires an Amiga with Kickstart 2.0 or higher and an input
  69.     device of some kind (ie. a serial port or a keyboard).
  70.  
  71. GENERAL
  72.     Matrix relies on specially formatted menu files.  The default
  73.     menu is "axsh:etc/menu/main", and the default prompt is
  74.     "Choice (Q to quit)", they can be changed with command line
  75.     arguments.
  76.  
  77.     Matrix's logfiles can be found in AXsh:etc/adm/ in the format
  78.     LogDDMMYY-Matrix.  All logs for one day are lumped together,
  79.     since users have a tendency of entering and exiting the menus
  80.     many times in a single session, which would result in millions
  81.     of tiny logs if they were separate.
  82.  
  83.     The menus from my own system are included.  Feel free to look at
  84.     them for guidance and even use in your own system, provided that
  85.     you at least delete the "Brahman" logos.  :)  Source code is
  86.     also included, more on that later...  The "sc" directory contains
  87.     two scripts, one for launching Matrix for sysops, the other
  88.     for launching Matrix for normal users.  I suggest adding a
  89.     line like "alias menu AXsh:sc/launchmatrix" to etc/GlobalLogin,
  90.     so users can simply type "menu" to get into the menu system.
  91.  
  92.     To convert from Topic to Matrix, all you have to do is add
  93.     a %exit command to your main menu, like this:
  94.  
  95.     q
  96.     %exit
  97.     ---
  98.  
  99.     However, that will mostly definately not be all you'll want to
  100.     do.  :)  As of v1.1, you may also need to add the following command
  101.     to your AXsh setup:
  102.  
  103.     SetEnv MATRIX_DIR <dir> [dir...]
  104.  
  105.     Where "dir" is a legal directory for Matrix menu files.  If you don't
  106.     have MATRIX_DIR, Matrix defaults to only allowing menus from
  107.     AXsh:etc/menu and AXsh:etc/adm.
  108.  
  109. MENU FILE SETUP
  110.     Matrix's menu files are almost identical to Topic's.
  111.     The format is this:
  112.  
  113.     Menu text (ANSI codes allowed)
  114.     #
  115.     <key>
  116.     <command> [arguments]
  117.     <options>[extended-options][special arguments]
  118.     ...repeat...
  119.     #
  120.  
  121.     This is almost the same as Topic.  The key can be one or more
  122.     letters, but unlike Topic, they're case sensitive.  The command
  123.     (which should have a full path) can be followed by arguments,
  124.     since I found Topic's method of putting them after the options
  125.     cumbersome.  Options are discussed later, but after them, there
  126.     are either more arguments which simply get appended to the command
  127.     string, or special arguments for options.  Lines of white space
  128.     are not allowed and will confuse Matrix badly; white space at
  129.     the end of lines is read in.
  130.  
  131. OPTIONS
  132.     Matrix follows Topic's options format with some extensions.
  133.     The format is crude, but changing it drastically and retaining
  134.     compatability would have been difficult.  Unlike Topic, you
  135.     can mix the options, for example raw mode with user argument is
  136.     possible in Matrix but impossible in Topic.  At any rate, the empty
  137.     options line should look like this:
  138.  
  139.     ---    *OR*    ---x--
  140.  
  141.     Filled up with the flags:
  142.  
  143.     rp?    *OR*    rp?xzm
  144.  
  145.     This is what the flags (which must be in the right place and order)
  146.     mean:
  147.  
  148.     r    Raw mode, ie. no buffering.  Required by some programs
  149.         like consolechat and SpaceDoor.
  150.  
  151.     p    Check path for ":", "/" or "$" marks in user's argument.
  152.         "$" is checked since variables are only expanded after they
  153.         are passed out of Matrix, and a sneaky user could define
  154.         one to contain a path.  WARNING: wildcards are *not*
  155.         scanned.  Make sure users can only load Matrix from
  156.         safe places.  Only useful with ?-flag.
  157.  
  158.     ?    Get argument(s) from user.  The question string is placed
  159.         in the special-arguments section.
  160.  
  161.     x    Signifies that extended options follow.
  162.  
  163.     z    Wait for a keypress after command finishes (unless in Expert mode).
  164.  
  165.     m    Set for %menu commands (more in next section).
  166.  
  167.     Some examples:
  168.  
  169.     w            Run 'who' and wait for a key
  170.     axsh:bin/who
  171.     ---xz-    
  172.  
  173.     d            Ask for a file/pattern to delete, check to
  174.     c:delete        make sure it's not a path, then delete the
  175.     -p?Filename:        file.
  176.  
  177.     c            Run consolechat in raw mode.
  178.     axsh:bin/cc
  179.     r--
  180.  
  181. SPECIAL COMMANDS
  182.     Matrix also introduces several special commands.  They are the
  183.     following:
  184.  
  185.     %exit - Exits Matrix.
  186.  
  187.     %menu <menufile> - Use this instead of just loading another copy
  188.     of Matrix, it's far more efficient and the logfiles will not get
  189.     mixed up.
  190.  
  191.     You must specify the extended option "m" in the 6th place.  To use
  192.     a prompt other than the default, place it in the special arguments
  193.     field.  Note: a space after the prompt *is* noticed by Matrix!
  194.     Example:
  195.     
  196.         f
  197.         %menu axsh:etc/menu/file
  198.         ---x-mFile Menu] 
  199.  
  200.     %quit - Same as exit.
  201.     
  202.     %xprt - Toggles expert mode on and off.  Selection is not saved to
  203.     disk, although user is told how to do it.  Local variable "expert"
  204.     is affected.
  205.  
  206.     
  207. EXTERNAL COMMANDS
  208.     At the moment, Matrix has four external commands that can be
  209.     run from outside Matrix to affect it.  Matrix will notice them
  210.     every time the menu is redisplayed and after a command returns.
  211.     Superuser commands can be run if the user is an assistant,
  212.     superuser, wizard or system.  The commands are:
  213.  
  214.     matrix abort        Kicks user out of Matrix.
  215.                 Superuser only.
  216.  
  217.     matrix chat        Forces the Matrix user into chat.
  218.                 Superuser only.
  219.  
  220.     matrix force <cmd>    Forces a CLI command to be executed.
  221.                 Superuser only.
  222.  
  223.     matrix page <text>    The text will be displayed in Matrix.
  224.  
  225.     Note that force's command and page's text do not need to be
  226.     surrounded by quote marks, although they may contain them in need.
  227.     The paging system is built in; however, chat and abort can be
  228.     redefined by the user.  To redefine chat, add a command whose key
  229.     is "MSG_CHAT"; to redefine abort, add a command whose key is
  230.     "MSG_ABRT".  MSG_ABRT is also run if time runs out, the inactivity
  231.     limit is crossed, or AXsh:etc/nologin is detected.  The defaults are
  232.     the following:
  233.  
  234.     Chat:    MSG_CHAT
  235.         AXsh:bin/chat
  236.         r--    
  237.  
  238.     Abort:    MSG_ABRT
  239.         %exit
  240.         ---
  241.  
  242.     The "Superuser forced..." texts are shown automatically and cannot
  243.     be changed (yet).  In addition, only the last external command sent
  244.     will be executed.
  245.  
  246. TIPS AND TRICKS
  247.     It's fully legal to assign multiple commands to the same key
  248.     (they'll be executed in sequential order from top to bottom) or
  249.     to execute an AmigaDOS script from a key.  However, MSG_*
  250.     keys cannot be stacked, use a script if you need to get around
  251.     this.
  252.  
  253.     If you want to have a user-defined command in a menu, you can
  254.     leave the arguments empty like this:
  255.  
  256.         u
  257.  
  258.         --?Enter command:
  259.  
  260.     Naturally, it would be smart to restrict access to such a command
  261.     to sysops.
  262.  
  263. SECURITY
  264.     Matrix, being independent of the AXshell, also doesn't have its
  265.     security restrictions.  Thus, you have to be very careful not
  266.     to let the user wreak havoc, intentionally or by accident,
  267.     on your system.  I strongly recommend that you make sure the user
  268.     loads it from his home directory in one of the following ways:
  269.  
  270.     Method 1, will prevent accidents but not a determined hacker
  271.  
  272.     Create a "menu" alias that executes a script like this:
  273.  
  274.     set olddir $cwd
  275.     cd $home
  276.     matrix random/menu "NicePrompt} "
  277.     cd $olddir
  278.     unset olddir
  279.  
  280.     This insures that matrix is run from home and restores the user to
  281.     the original directory afterwards, but can be circumvented quite
  282.     easily.
  283.  
  284.     Method 2, secure but a bit inconvinient:
  285.  
  286.     Lump all commands like "delete" and "more" in one submenu,
  287.     then give something like this for its command:
  288.  
  289.     f
  290.     cd $home
  291.     ---
  292.     f
  293.     %menu axsh:etc/menu/file
  294.     ---File]
  295.     
  296.     There's more.  Matrix and Topic will both happily show the
  297.     contents of any file they are given (in a legal directory, of
  298.     course) until they realize it's    not a menu file by hitting the end.
  299.     Thus, leave nothing interesting in the menu directories.
  300.  
  301.     On my system, the sysops have their own menu, which gives them
  302.     access to a whole range of dangerous goodies.  Needless to say,
  303.     you do *not* want normal users to be able to use it...  The
  304.     solution is simple: place the sysop menu in a directory where
  305.     the users can't touch it!  I use AXsh:etc/adm for the sysop menu
  306.     and AXsh:etc/menu for the normal menus.
  307.  
  308.     Remember, Matrix path checking does not stop wildcards, and things
  309.     like "delete * all" can slip through.  This is why you must make
  310.     sure the users are in their home directories.
  311.  
  312. OTHER SYSTEMS
  313.     If you want to use Matrix with systems other than AXsh, the
  314.     following local variables must be set:
  315.  
  316.     user        The user's name
  317.  
  318.     Setting this variable is recommended:
  319.  
  320.     accesslevel    Set to "superuser" for Matrix externals.
  321.  
  322.     And you will have to create the directory AXsh:etc/adm for
  323.     logfiles.  Also, you'll probably want to redefine MSG_CHAT to
  324.     use another program instead of AXsh:bin/chat.
  325.  
  326. FUTURE FEATURES
  327.     In the future, I plan on adding some or all of the following:
  328.  
  329.     - a separate Topic/Matrix menu editor
  330.     - full multi-user support
  331.     - support for multiple external commands simultaneously, and
  332.       replacement of crude global variable system with politically
  333.       correct message ports
  334.     - commands that can only be executed by users with a given
  335.       accesslevel
  336.     - axsh:etc/rc used to check path validity if desired
  337.     - letting the user respond to pages
  338.     - better support for non-AXsh systems
  339.     - more flexibility to the Topic/Matrix menu format
  340.     
  341. AUTHOR           _
  342.     Jani "Guru Gnosis Sahib" Poijärvi
  343.     Internet: root@brahman.nullnet.fi
  344.     BBS: Brahman, +358-0-498-797, USR 16800 DS, 24h/7d
  345.              (official Matrix support site)
  346.  
  347. FILES
  348.     bin/matrix
  349.     etc/adm/LogDDMMYY-Matrix
  350.     etc/menu/*
  351.  
  352. SEE ALSO
  353.     timeout
  354.     topic
  355.  
  356. NOTES
  357.     AXsh internal commands (quit, write, login, etc) cannot be used
  358.     since they're internal and Matrix is not the AXshell.  Likewise,
  359.     the AXsh directory conventions ("..", "/", "~") are not (yet)
  360.     understood, and AmigaDOS parsing is used.
  361.  
  362.     There is a limit of 48 commands in a single menu.  If this
  363.     is too restrictive, redesign your menu, or change the MAX_ITEM
  364.     #define and recompile.
  365.  
  366.     Matrix was written entirely with DICE C, and the bulk of the code
  367.     was written in 2 days during Christmas vacation.  The source
  368.     is included and should be reasonably portable.  Feel free to
  369.     modify, but don't distribute modified code without permission,
  370.     and send interesting modifications to me.  Hell, send me mail
  371.     just to let me know you exist and that I didn't waste my
  372.     vacation for nothing...
  373.  
  374. BUGS
  375.     Matrix's largest bug is that multiple copies of it running at
  376.     the same time will cause assorted havoc.  They should all *work*:
  377.     however, external commands and logging will function highly
  378.     erratically, if at all.  Avoid if you can, I'm planning on fixing the
  379.     whole system for v2.0.
  380.  
  381.     Other than that, there are just undocumented features.  :)
  382.